import axios from '@/libs/api.request'
// let rol = 'api/'
// 获取角色列表
export const roleList = (data) => {
  return axios.request({
    url: 'oms/merchant/role/query',
    method: 'post',
    data: data
  })
}

export const enableRole = (data) => {
  return axios.request({
    url: 'oms/merchant/role/status/enable',
    method: 'post',
    data: data
  })
}

export const disableRole = (data) => {
  return axios.request({
    url: 'oms/merchant/role/status/disable',
    method: 'post',
    data: data
  })
}
export const copyRole = (data) => {
  return axios.request({
    url: 'oms/merchant/role/copy',
    method: 'post',
    data: data
  })
}
export const createRole = (data) => {
  return axios.request({
    url: 'oms/merchant/role/create',
    method: 'post',
    data: data
  })
}
export const demandRole = (data) => {
  return axios.request({
    url: 'oms/merchant/role/info',
    method: 'post',
    data: data
  })
}
export const updateRole = (data) => {
  return axios.request({
    url: 'oms/merchant/role/update',
    method: 'post',
    data: data
  })
}
export const delRole = (data) => {
  return axios.request({
    url: 'oms/merchant/role/delete',
    method: 'post',
    data: data
  })
}
export const resourceTreeList = (data) => {
  return axios.request({
    url: 'oms/platform/resource/tree',
    method: 'post',
    data: data
  })
}
export const permissionTreeList = (data) => {
  return axios.request({
    url: 'oms/merchant/role/permissions/functions',
    method: 'post',
    data: data
  })
}
export const demandResourceList = (data) => {
  return axios.request({
    url: 'oms/platform/resource/list',
    method: 'post',
    data: data
  })
}
export const setfunctionGrant = (data) => {
  return axios.request({
    url: '/oms/merchant/user/permission/function/grant',
    // url: rol + 'user/permission/function/grant',
    method: 'post',
    data: data
  })
}
// 导出角色列表
export const exportRole = (data) => {
  return axios.request({
    url: '/oms/merchant/role/export',
    method: 'post',
    data: data,
    responseType: 'blob'
  })
}

// 验证xls数据
export const veriRoleXls = data => axios.request({
  url: '/oms/merchant/role/verify/file',
  method: 'post',
  data,
  headers: {
    'Content-Type': 'multipart/form-data'
  }
})

// 导入xls数据
export const roleXlsImport = data => axios.request({
  url: '/oms/merchant/role/import',
  method: 'post',
  data
})
